package com.yuedou.jylt.facelib.core;

import androidx.annotation.Keep;

import java.util.ArrayList;
import java.util.List;

public class AndroidConfig
{
    public List<Func> openFuncList;
    public int inputImageW;
    public int inputImageH;
    public int outputImageW;
    public int outputImageH;
    public ImageFormat imageFormat;
    public HandleMode handleMode;
    
    public AndroidConfig() {
        this.openFuncList = new ArrayList<Func>();
        this.handleMode = HandleMode.Camera;
    }
    
    public AndroidConfig openFunc(final Func func) {
        this.openFuncList.add(func);
        return this;
    }
    
    public AndroidConfig setInputImageSize(final int w, final int h) {
        this.inputImageW = w;
        this.inputImageH = h;
        return this;
    }
    
    public AndroidConfig setOutputImageSize(final int w, final int h) {
        this.outputImageW = w;
        this.outputImageH = h;
        return this;
    }
    
    public AndroidConfig setInputImageFormat(final ImageFormat imageFormat) {
        this.imageFormat = imageFormat;
        return this;
    }
    
    public AndroidConfig setDefaultFunc() {
        this.openFunc(Func.Detect);
        this.openFunc(Func.Landmark);
        return this;
    }
    
    public AndroidConfig setDefaultInputImageFormat() {
        this.setInputImageFormat(ImageFormat.YUV_NV21);
        return this;
    }
    
    public AndroidConfig setCameraMode() {
        this.handleMode = HandleMode.Camera;
        return this;
    }
    
    public AndroidConfig setNormalMode() {
        this.handleMode = HandleMode.Normal;
        return this;
    }
    
    public static AndroidConfig create() {
        return new AndroidConfig();
    }
    
    @Keep
    public enum Func
    {
        Detect, 
        Landmark, 
        Attribution, 
        BlazeFace, 
        FaceMesh;
    }
    
    @Keep
    public enum ImageFormat
    {
        YUV_NV21, 
        RGB, 
        RGBA, 
        GRAY;
    }
    
    @Keep
    public enum HandleMode
    {
        Normal, 
        Camera;
    }
}
